/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package deatax.unit;

import deatax.Player;
import deatax.Tile;
import deatax.markers.Marker;

/**
 *
 * @author Pieman
 */
public class UnitStack {
    
    private Unit type;
    private int amount;
    private Tile tile;
    private Player owner;
    private int tired;

    public UnitStack(Player owner, Tile tile, Unit type, int amount) {
        this.type = type;
        this.amount = amount;
        this.tile = tile;
        this.owner = owner;
        tired = 0;
    }

    public void freshenUp() {
        tired = 0;
    }
    
    public int getFreshAmount() {
        return amount - tired;
    }
    
    public void tire(int num) {
        tired += num;
        if (tired > amount) {
            tired = amount;
        }
    }
    
    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

    public Player getOwner() {
        return owner;
    }

    public void setOwner(Player owner) {
        this.owner = owner;
    }

    public Tile getTile() {
        return tile;
    }

    public void setTile(Tile tile) {
        this.tile = tile;
    }

    public Unit getType() {
        return type;
    }

    public void setType(Unit type) {
        this.type = type;
    }
    
    public void add(int n) {
        amount += n;
    }
    
    public Marker getMarker(){
        return type.getMarker(owner,amount);
    }
}
